﻿using System.Linq;
using System.Reflection;
using System;

namespace IInject.Reflection
{
	public class Method : MethodWrapper
	{
		private MethodInfo _info;
		private Parameter _returnParameter;

		public Method(MethodInfo methodInfo) : base(methodInfo)
		{
			_info = methodInfo;
			_returnParameter = ParameterProvider.GetParameter(_info.ReturnParameter);
		}

		public Type ReturnType
		{
			get
			{
				return _info.ReturnType;
			}
		}

		public Parameter ReturnParameter
		{
			get
			{
				return _returnParameter;
			}
		}

		public virtual Method MakeGenericMethod(params Type[] genericArgs)
		{
			return new Method(_info.MakeGenericMethod(genericArgs));
		}
	}
}
